TMMPlot

This Delphi-Component allows the user to easily display a HPGL/2-plot on a form,
paintbox or printer canvas. Free definable pencolors, widths.

The functionality is comparable to the mediaplayer. The component has no own
canvas but needs a canvas to display the graphics. Pencolors, -widths and styles
are set automatically, other canvasoptions have to be preset.

Professional Version includes zoom & pan and zoom-to-printer, print-2-scale.
16bit Pro version includes serial/parallel communication component (send-to-plotter).

LIST OF FILES.

	    File                    Description

	TMMPlot.TXT      Software Documentation (this file).
 	TMMPlot.REG      Registration form.
 	MMReg.PAS        Component library registration file.
 	MMReg.DCR        Component resource file.
 	MMPlot_U.DCU     Component object code.
 	MMPort_U.PAS     Component source code.
 	MMPLOT16.DLL     DLL required from TMMPLOT and MMPlot.EXE (16bit)
 	MMPLOT32.DLL     DLL required from TMMPLOT and MMPlot.EXE (32bit)
  (It is recommended to copy MMPlot16.DLL into your WINDOWS or SYSTEM directory)
 	DEMO.DPR         Demo project file
 	DEMO.RES         Demo project resource file
 	MAIN.PAS         Demo unit
 	MAIN.DFM         Demo form
 	SETTINGS.PAS     Demo unit
 	SETTINGS.DFM     Demo form
 	SAMPLE.PLT       Demo-Plotfile.
eventually:
        MMPlot.EXE       Viewer based on TMMPLOT
 	MMPlot.TXT       Software Documentation (Viewer).



PROPERTIES

-Published-

Active: boolean      Active=true opens a file and projection is enabled.

Align : TAlignment   Align (isotropic) Picture on Canvas.
        TAlignment = class(TPersistent)
          property Horizontal: THorizAlignment
          property Vertical  : TVertAlignment
        end;
        THorizAlignment = (haLeft, haCenter, haRight);
        TVertAlignment  = (vaTop, vaCenter, vaBottom);

Display: tpaintbox   The projector screen can be selected. If no paintbox is
                     available/selected, the parent form will be the display.

GraphDir, GraphName: string    Plotdirectory and HPGL-Sourcefile

IsOpen:boolean       Plotfile was opened
IsZoomed:boolean     Zoom active
IsPanned:boolean     Pan active

MapMode: TMapMode    Show Plot in isotropic/anisotropic mode
                     mmIsotropic   : Correct Aspect-Ratio
                     mmAnisotropic : Size-to-Fit, maximal extension
[**]                 mmHimetric    : originally scaled (Options+goOrigScale)

Name: TComponentname

Options: TGraphOptions Various graphic options can be set as there are:
[**]                             goPrint       : Output to Printer
[**]                             goOrigScale   : Print in original scale (himetric)
[**]                             goGrid        : Display pageframes on screen.
[**]                             goPageNums    : Print Pagenumbers on the different sheets.
[**]                             goBlackprint  : Print using black pen for all colors.

Startpage, Endpage, PrintCopies: word
[**]                             See TReport....

Painttiming: TPaintTiming
                                 This depicts when the OnPaint-eventhandling will be
                                 executed in relation to Display.OnPaint.
                                 Possible values are:
                                 ptBefore : Before Display.OnPaint
                                 ptReplace: Instead of Display.OnPaint
                                 ptAfter  : After Display.OnPaint

Pen1...Pen8: tcolor  colors for plotter-pens no 1..8

Port: TMMComm        no longer exists. Use TMMPort Component instead.

Title:string         Title displayed in printmanager


-Public-

Version : string        RevisionCode  ( 16.02e = 16bit - revision 2 - english )
Error   : string        Display Errortext and clear it (if any)
Filename: string        HPGL-file with complete path
Blackprint: boolean     All printer output will use black pen & brush
PrintControl: boolean   If true(default) the component performs the printjob
                        stuff automatically (begindoc..nextpage..enddoc), if
                        false this has to be done externally. 
PenColor[Index:Integer]:tColor    up to 255 pencolors can be set
PenWidth[Index:Integer]:byte      default = 25 ~ PW0.25[mm] individual penwidth
                        for each pen overrides original value if setpenwidths=true  
BackGnd :Tcolor         Backgroundcolor used for dithered fill
DitherOfs:integer       Correction offset to fix dithering density
Penfactor:integer       Correction factor to fix penwidths
                        Default = 4 --> PW0.25 * 4 = 1 pixel
Fontfactor:integer       Correction factor to fix fontsize
ZoomPen : boolean       Zoom Penwidths according to picture zoom.
SetPenWidths: boolean;  If true, the penwidth-"palette" will be used.
Align   : TAlignment
BorderY : integer;      Border Top/Bottom
BorderX : integer;      Border Left/Right
Scale   : real;         Scaling Factor 1:x for original scale  
Angle   : real;         Rotation angle [0/90/180/270]
AsBMP   : TBitmap;      read only
AsMeta  : TMetafile;    read only
Enhanced: boolean       Convert as Windows Enhanced Metafile (32bit only).
PrintControl:boolean    When set false, tmmplot will not handle the printjob
                        (begindoc,nextpage,enddoc).

METHODS

constructor Create(AOwner: TComponent);
destructor  Free;
procedure   Close;                      Deactivate, Close Plotfile
procedure   ZoomAll;                    Reset Zoom, Refresh
procedure   SetZoom( r : trect );       Zoom-In
procedure   Pan    ( r : trect );       Pan
function    SaveFileAs(newname:tfilename):boolean;     Save Plotdata in binary file
                                                       Format depends on extension:
                                                       *.BMP - Bitmap
                                                       *.WMF - Windows Meta File
                                                       *.EMF - Enh. Meta File (WIN32 only)
                                                       *.TXT - Labels as ASCII
                                                       *.DAT - MMplot Metafile
                                                       Returns TRUE if ERROR !!!
function    SaveLabels(fname:tfilename):boolean;       Save Labels as ASCII-Text

procedure BuildAsBitmap(Display: TObject); build in memory
procedure BuildAsMeta(Display: TObject);   build in memory
procedure Post(Display: TObject);     output bitmap/metafile on display

procedure Hardcopy;                   Hardcopy in actual mode
function  Send:boolean;               no longer exists. Use TMMPort Component instead.
procedure SetDefPal_255;              Set system default palette colors
procedure SetPlotPal_255;             Set palette colors from Plot (if any)
procedure SetACADPal_9;	              Set Pen 1..9 Autocad colors
procedure SetPlotPenWidth;            Set pen widths from Plot (if any)

function  Size( Var mmx,mmy   : longint;
                Var PageCount : word
               ):boolean;    { true = ERROR }
           Returns the Dimensions of the Plot and the amount of printer pages
           it would take to print the whole thing in original scale.
function  Info( p : pPlotInfo ):boolean;
                Provides more details concerning the plot in the following structure:

  plotInfo = ^tPlotInfo;              { pointer on struct }
  type tPlotInfo = record
     mmx, mmy,                        { Dim [mm] }
     plxmax,                          { Max x [plotunit] }
     plymax,                          { Max y [plotunit] }
     plxmin,                          { Min x [plotunit] }
     plymin : longint;                { Min y [plotunit] }
     penbuf : array[0..255] of byte;  { used pens (penbuf[0]=highest penNr) }
                                      { penbuff[i] > 0 = pen i used }
     pages  : word;                   { required page# on actual printer }
  end;

procedure Orientate(r:real);  Discontinued. Use property Angle instead.
			      Set rotation angle: r=0/90/180/270
                              In general, any angle is allowed but
                              positioning and sizing is accurate with
                              above angles only.

EVENTS
    OnActivate
    OnDeactivate
    OnFileOpen       File will be opened on first activation or on a call
                     to .Size or .Info method.
    OnPaint          Paint event, hooked into display's paintevent
                     See property painttiming.


Installing TMMPlot

To install this VCL, copy both MMReg.PAS, MMPlot_U.DCU, eventually
MMPort_U.DCU/PAS and MMReg.DCR to the directory where you have your
other shareware controls.
Then, from Delphi's main menu, select Options|Install Components.
In the dialog, click on the Add... button, then Browse... and change
to the drive/directory where you stored the above two files.
Select MMReg.PAS and click OK, then OK again.
Copy MMPLOT16.DLL into Your outputdirectory for your EXE or DLL or to
Your Windows or System directory (recommended for Designers).
The component needs MMPLOT16.DLL to interpret HPGL-files.  The DLL
is dynamically loaded and may not be needed if the plot is "precompiled".
See section below for more information.
You can edit MMReg.PAS to determine into which gallery page the MMxyz
component(s) should be installed.

Using TMMPlot

To use this control, simply place it on your form, and edit the
Graphname, Options, Pens and Display properties.

You can use TMMPLOT without MMPLOT16.DLL in certain circumstances.
The DLL is loaded dynamically when the first HPGLfile is opened.
Raw graphic data is saved in a temporary binary file (Property FFilename).
You can display this kind of file (*.TMP;*.DAT) without the use of the DLL.
Loading is much faster and the DLL is not required.
The demo shows how to do this. Action: Save as xxx.dat..., then open this
file...

The "Copy to file or Port" functionality has been removed from MMPlot, use
a separate MMPort component instead.

The Dithered fill will not work on all printers.

The printcontrol flag can be set to FALSE to include the printing of a draft
into a printjob. When set false the component will not generate any printer
control sequences (begindoc,enddoc,nextpage...) Please note that no formfeeds
are generated, so if a draft takes more than one page, the pages have to be 
printed individually.

The scaling factor for original scale has been implemented for shrinking and
only been tested with positive values (0,5..10).


Procedural interface

Function PlotSizeFromFile( Filename : tfilename;    plotfile
                       Var mmx,                     plotwidth [mm]
                           mmy      : longint;      plotheight [mm]
                       Var PageCount: word          # printer pages (using print-2-scale)
                             ):boolean;             true if ERROR !!!

Function PlotInfoFromFile( FName   : tfilename;
                           p       : pPlotInfo):boolean; true if ERROR !!!

Function OutPlot( Filename : tfilename;
                  pSpec   : pPrintSpec ):boolean;

TPrintSpec = record
   Filename : tfilename;
   Dest     : tObject;    { Form, Printer, Picturebox...}
   Mapmode,               { 0 = isotropic, 1 = Anisotropic, 2 = Himetric }
   FromPage, ToPage ,     { [**] print-to-scale only }
   Penfactor,             { Default = 4 }
   Ditherofs: integer;    { Adjust dithering }
   Scale    : real;       { Scalingfactor (Himetric/goOrigScale) 1:Scale }
   PrintControl,          { if false, printjob commands are not handled }
   BlackPrint,	          { print all colours with black pen }
   ZoomPen  : boolean;    { Zoom Penwidths }
   Options  : TGraphOptions
   Align    : TAlignment;
   Viewport : TRect;      { applied on Align = xxPosition }
 end;
 pPrintSpec = ^TPrintSpec;

Function GetDLLVersion:String   ( 16.02e = 16bit - revision 2 - english )

Further options  [**]

 Zoom & Pan and print-to-scale are not included in the LITE version.
 Professional version is released including all features.
 The component is designed to display on paintboxes or the form but
 any canvas should be possible as output media. Please feel free to contact
 me if You have any special needs.
 All Features have been tested under Win3.11/95/NT.
 A 32bit Version of the DLL/Component is also available.
 A serial/parallel communications component TMMPort is shipped with the pro
 version(16) plus demo and documented source code.
 MMPlot hpgl/2-viewer is available as shareware. Also 32bit Version.
 The Component/DLL is available in english and german, please contact if you
 prefer another language.

Benefits of Registration

 Most HPGL/2 language is implemented. Registered users are supported if
 they have problems with a special plotformat.
 The unregistered component includes from time to time a shareware message
 into the output.
 Registered users have the right to incorporate and distribute the component as
 part of their application(s).
 Registered Users (Pro.16) receive the source code of the Communications
 Component TMMPort.

Registering TMMPlot

To register TMMPlot lite, send $85 (+$8 S&H) to:
To register TMMPlot professional, send $425 (+$8 S&H) to:

MAMAVISION Software Consult
Wollmatingerstr. 70B
78467 Konstanz
*** Germany ***

or register in Compuserve:   Lite.16 - GO SWREG 9785
                              Pro.16 - GO SWREG 10070
                             Lite.32 - GO SWREG ?????
                              Pro.32 - GO SWREG ?????

Please report all bugs, suggestions, and problems to:

Markus Mayer
Compuserve ID: 100335,430
Internet adress: 100335.430@CompuServe.com

You can save the $8 shipping fee by specifying a Compuserve
account to have your control sent to instead of by mail.

Although TMMPlot functions flawlessly on our computer systems the
authors assume no responsibility for the use or misuse of the component.
This package may be copied and distributed freely providing that it is
not modified, no fee is charged, and it is not made part of a package for
which a charge is made.  If you upload this package to other bulletin boards,
we'd appreciate it if you would try to keep the upload current.

TMMPlot is (c)1996 copyright by MAMAVISION Software Consult 
